<?php
	/**
	 * 获取排行榜
	 */
    class MoneyCharts extends APIBase {
		
		public $tag = "MoneyCharts";
		public $isLogin = false;
		public $chartsname = array('免费榜',
									'铜牌榜',
									'银牌榜',
									'金牌榜',
									'钻石榜'
							 );
		public function before() {
			$this->initCacheRedis();
			return true;
		}

		public function logic() {
			$data = array();
			//1号场馆金币排行
			for($i=0;$i<5;$i++){
				$charts = array();
				for ($j=1;$j<=10;$j++){
					$moneyCharts = $this->cache_redis->hMget("cv$i:$j",array('uid', 'name',  'amount', 'num'));
					$moneyCharts["uid"] = (int)$moneyCharts["uid"];
					$moneyCharts["name"] = $moneyCharts["name"];
					$moneyCharts["num"] = (int)$moneyCharts["num"];
					$moneyCharts["amount"] = (int)$moneyCharts["amount"];
					$charts[$j] = $moneyCharts;
				}
				$data["mc$i"] = $charts;
				$data["cname$i"] = $this->chartsname[$i];
				unset($charts);
			}
// 			var_dump($data);
			$this->returnData($data);
		}
		
    	public function after() {
			$this->deinitCacheRedis();
		}
    }
?>